package com.yjha.ai.demos.web.mapper;

import com.yjha.ai.demos.web.entity.Recording;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface RecordingMapper{
    @Insert("insert into recording (id , user_message , sys_message , data , display_type) values (0 , #{userMessage} , #{sysMessage} , #{data} , #{displayType})")
    @Options(useGeneratedKeys = true, keyColumn = "ID", keyProperty = "id")
    void save(Recording recording);

    @Select("select * from recording where id = #{id}")
    @Results({
            @Result(column="id", property="id", jdbcType= JdbcType.INTEGER),
            @Result(column="user_message", property="userMessage", jdbcType=JdbcType.LONGVARCHAR),
            @Result(column="sys_message", property="sysMessage", jdbcType=JdbcType.LONGVARCHAR),
            @Result(column="data", property="data", jdbcType=JdbcType.LONGVARCHAR),
            @Result(column="display_type", property="displayType", jdbcType=JdbcType.LONGVARCHAR),
    })
    Recording getHistoryById(Integer id);
}
